<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
    <head th:include="common_include :: commonHead('部门添加')"/>
    <link href="/libs/iCheck/custom.css" th:href="@{/libs/iCheck/custom.css}" rel="stylesheet"/>
    <body class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m" id="form-dept-add">
                        <input id="pid" name="pid" type="hidden" th:value="${dept.rowKey}"/>
                        <div class="form-group">
                            <label class="col-sm-3 control-label ">上级部门</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" id="treeName" readonly="true"
                                       th:value="${dept.deptName}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">部门名称</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="deptName" id="deptName" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">负责人</label>
                            <div class="col-sm-8">
                                <input id="leader" name="leader" class="form-control" type="text" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">联系电话</label>
                            <div class="col-sm-8">
                                <input id="phone" name="phone" class="form-control" type="text" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">电子邮箱</label>
                            <div class="col-sm-8">
                                <input id="email" name="email" class="form-control" type="email" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">联系地址</label>
                            <div class="col-sm-8">
                                <input id="address" name="address" class="form-control" type="text" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">显示排序</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="number" name="sortNumber" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">部门状态</label>
                            <div class="col-sm-8"
                                 th:with="dicts=${@dictCode.selectDictCodeByType('sys_normal_disable')}">
                                <div th:each="dict : ${dicts}" th:class="${dict['cssStyle']}">
                                    <input type="radio" th:id="${dict['codeValue']}" name="deptStatus" th:value="${dict['codeValue']}"
                                           th:checked="${dict['isDefault'] == 'Y' ? true : false}" />
                                    <label th:for="${dict['codeValue']}" th:text="${dict['codeText']}"></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注</label>
                            <div class="col-sm-8">
                                <input id="remark" name="deptRemark" class="form-control" type="text" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">模块名称</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="moduleName">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <head th:include="common_include :: commonFoot"/>
        <script th:src="@{/libs/iCheck/icheck.min.js}"></script>
        <script>
            var prefix = ctx + "upms/dept"

            $("#form-dept-add").validate({
                rules: {
                    deptName: {
                        required: true,
                    },
                    sortNumber: {
                        required: true,
                        digits:true,
                    },
                },
                submitHandler: function (form) {
                    $.operate.save(prefix + "/add", $('#form-dept-add').serialize());
                }
            });

            function submitClick() {
                if($('#form-dept-add').valid()){
                    $('#form-dept-add').submit()
                }
            }
        </script>
    </body>
</html>
